<template>
  <div class="main price-detail-container">
    <el-form label-position="top" label-width="80px" :model="formData" ref="formData">
      <el-form-item label="调价申请" :rules="[{ required: true }]">
        <el-input :disabled="true" type="textarea" :autosize="{ minRows: 5, maxRows: 5 }" v-model="formData.modifyReason"></el-input>
      </el-form-item>
      <el-form-item label="调价明细" :rules="[{ required: true }]"></el-form-item>
      <el-table :data="formData.skuList" style="width: 100%" border>
        <el-table-column label="商品编码" prop="serialNo"></el-table-column>
        <el-table-column label="商品名称" prop="name"></el-table-column>
        <el-table-column label="颜色" prop="color"></el-table-column>
        <el-table-column label="规格" prop="spec"></el-table-column>
        <el-table-column label="商家SKU编码" prop="merSkuNo"></el-table-column>
        <el-table-column label="平台SKU编码" prop="skuId"></el-table-column>
        <el-table-column label="供货价(调整前)" prop="beforeSupplyPrice"></el-table-column>
        <el-table-column label="供货价(调整后)" prop="afterSupplyPrice"></el-table-column>
      </el-table>
    </el-form>
    <div>
        <div class="title">* 审核日志</div>
          <el-table :data="auditRecordList" header-row-class-name="table-header" element-loading-text="给我一点时间" border highlight-current-row>
              <el-table-column align="center" prop="auditNode" label="审核节点" min-width="100"></el-table-column>
              <el-table-column align="center" prop="auditor" label="审核人" min-width="100"></el-table-column>
              <el-table-column align="center" prop="createdAt" label="审核时间" min-width="100">
              <template slot-scope="scope">
                  <span>{{formatDate(scope.row.createdAt, 'YYYY-MM-DD HH:mm:ss')}}</span>
              </template>
              </el-table-column>
              <el-table-column align="center" prop="auditResult" label="审核结果" min-width="100"></el-table-column>
              <el-table-column align="center" prop="auditRemark" label="审核意见" min-width="100"></el-table-column>
          </el-table>
      </div>
  </div>
</template>
<script>
import { adjustGoodsPriceDetail } from '@/api/merchantsys/price'
import { auditRecord } from '@/api/merchantsys/goods'
export default {
  name: 'addModifyPrice',
  metaInfo() {
    return {
      titleTemplate: '入驻 - %s'
    }
  },
  data() {
    return {
      auditRecordList: [],
      formData: {
        accountId: null,
        modifyReason: null,
        skuList: []
      }
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    loadAuditRecord(){
      if(this.formData.processId){
        auditRecord({audit_process_id: this.formData.processId}).then(res=>{
          this.auditRecordList = res.data
        })
      }
    },
    //请求商品调价详情
    fetchData() {
      adjustGoodsPriceDetail({
        id: this.$route.params.id
      }).then(res => {
        this.formData = res.data
        this.loadAuditRecord()
      })
    }
  }
}
</script>

<style lang="scss" scoped>

.price-detail-container{
  .title{
        font-size: 14px;
        color: rgb(95, 91, 91);
        font-weight: bold;
        line-height: 38px;
        margin-top: 10px;
      }
}

</style>
